k8s yaml example

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: chenshi
  namespace: chenshi
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 50Gi
  storageClassName: chenshi
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: chenshi
  namespace: chenshi
data:
  mysql.database.host: "chenshi.net"
  mysql.database.name: "chenshi"
  mysql.database.username: "chenshi"
  mysql.database.password: "chenshi.net"
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: chenshi
  name: chenshi
  namespace: chenshi
spec:
  replicas: 1
  selector:
    matchLabels:
      app: chenshi
  strategy: {}
  template:
    metadata:
      labels:
        app: chenshi
    spec:
      hostAliases:
      - ip: "192.168.0.2"
        hostnames:
        - "chenshi-extra"
      hostNetwork: true
      nodeSelector:
        nodes: "chenshi"
      tolerations:
        - key: "nodes"
          operator: "Equal"
          value: "chenshi"
          effect: "NoSchedule"
  affinity:
    podAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
      - labelSelector:
          matchExpressions:
          - key: node
            operator: In
            values:
            - chenshi
        topologyKey: topology.kubernetes.io/zone
    podAntiAffinity:
      preferredrequiredDuringSchedulingIgnoredDuringExecution:
      - podAffinityTerm:
          labelSelector:
            matchExpressions:
              - key: node
                operator: In
                values:
                - chenshi
          topologyKey: kubernetes.io/hostname
        weight: 100
      imagePullSecrets:
      - name: chenshi
      enableServiceLinks: false
      initContainers:
      - name: plugins
        image: busybox
        command: ['sh', '-c', "mkdir -p /plugins/"]
        #command: ['sh', '-c', 'until nslookup mysql;do sleep 2;done;']
        volumeMounts:
        - name: chenshi
          mountPath: "/plugins/"
      containers:
      - image: chenshi.net/chenshi:latest
        name: chenshi
        command: ["chenshi"]
        args: ["-c", "/etc/chenshi.conf"]
        imagePullPolicy: Always
        lifecycle:
          postStart:
            exec:
              command:
              - /bin/bash
              - -c
              - echo testing >> /etc/chenshi.conf
        readinessProbe:
          httpGet:
            path: /health
            port: 80
          initialDelaySeconds: 5
          periodSeconds: 5
        livenessProbe:
          httpGet:
            path: /health
            port: 80
          initialDelaySeconds: 5
          periodSeconds: 5
        envFrom:
        - configMapRef:
            name: chenshi
        ports:
        - containerPort: 80
          name: tcp80
        - containerPort: 443
          name: tcp443
        volumeMounts:
          - name: chenshi
            mountPath: /var/lib/chenshi/
          - name: chenshi-config
            mountPath: /etc/
        resources:
          limits:
            cpu: 1
            memory: 1Gi
          requests:
            cpu: 256m
            memory: 256Mi
      securityContext:
        fsGroup: 65534
      volumes:
        - name: chenshi
          nfs:
            server: 192.168.0.1
            path: /nfs/chenshi
        - name: chenshi-config
          configMap:
            name: chenshi-extra
      #volumes:
      #- name: chenshi
        #persistentVolumeClaim:
          #claimName: chenshi
---
apiVersion: v1
kind: Service
metadata:
  creationTimestamp: null
  labels:
    app: chenshi
  name: chenshi
  namespace: chenshi
spec:
  ports:
  - port: 80
    protocol: TCP
    targetPort: 80
    name: tcp80
  - port: 443
    protocol: TCP
    targetPort: 443
    name: tcp4433
  selector:
    app: chenshi
  type: ClusterIP